package com.liy.cloud.auth.client;

import com.liy.cloud.auth.client.config.UserAuthConfig;
import feign.Logger.Level;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

@EnableFeignClients( basePackages = {"com.liy.cloud.auth.client.feign"} )
@EnableHystrix
@Configuration
@EnableScheduling
@ComponentScan({"com.liy.cloud.auth.client"})
public class AuthorizationConfiguration {

    @Bean
    UserAuthConfig getUserAuthConfig() {
        return new UserAuthConfig();
    }

    @Bean
    @LoadBalanced
    RestTemplate getRestTempalte() {
        return new RestTemplate();
    }

    @Bean
    Level feignLoggerLevel() {
        return Level.FULL;
    }
}
